<?
layout("/inc/win_layout.html",{title:sysTitle}){}
    ?>

<div class="page-content" >
		<div class="row mbl" >
			<div class="col-lg-12" >
					<table style="width: 95%;margin-top: 20px;">
						<tr height="50">
							<td align="right" style="width: 100px;">资源类型&nbsp;&nbsp;</td>
							<td>
								<select class="form-control" id="classes">
									<option value="">请选择</option>
									<?for(c in classes){?>
										<option value="${c.nameEn}">${c.nameZh}</option>
									<?}?>
								</select>
							</td>
							<td align="right" style="width: 100px;">资源标题&nbsp;&nbsp;</td>
							<td><input type="text" class="form-control" style="width: 100%;" id="title" name="title" /></td> 
							<td align="right" style="width: 100px;">资源ID&nbsp;&nbsp;</td>
							<td><input type="text" class="form-control" style="width: 100%;" id="resourcesId" name="resourcesId" /></td>
						</tr>
						<tr height="50">
							<td align="right" style="width: 100px;">所属产品&nbsp;&nbsp;</td>
								<td>
									<select class="form-control" id="repositoryProduct">
										<option value="">请选择</option>
										<?for(rp in repositoryProduct){?>
											<option value="${rp.id}">${rp.name}</option>
										<?}?>
									</select>
								</td>
								<td align="right" style="width: 100px;">所属项目&nbsp;&nbsp;</td>
								<td>
									<select class="form-control" id="project">
										<option value="">请选择</option>
										<?for(p in project){?>
											<option value="${p.id}">${p.nameZh}</option>
										<?}?>
									</select>
								</td>
							
								<td align="center" style="width: 100px;">
									<button type="button" style="margin-left: 80px;" data-toggle="dropdown" class="btn btn-success dropdown-toggle" onclick="queryUser(1)">查询</button>
								</td>
								<td style="padding-left: 10px;">
								<button class="btn btn-primary" onclick="deleteSearch()">清空</button>
								</td>
							</tr>
					</table>
			</div>
		</div>
		<table class="table table-hover table-striped table-bordered table-advanced tablesorter mbn">
			<thead>
				<tr>
					<th >序号</th>
					<th >资源类型</th>
					<th >资源ID</th>
					<th >资源标题</th>
					<th >资源单价</th>
					<th >资源优惠信息</th>
					<th >资源数量</th>
					<th >所属产品</th>
					<th >所属项目</th>
				</tr>
			</thead>
			<tbody id="findUser">
			
			</tbody>
		</table>
		<div id="page2" style="text-align: center; margin-top: 10px;"></div>
	</div>
<script type="text/javascript">
	var id = window.parent.getlay();
	$(function()  {
		queryUser(1);
	});
	
	function queryUser(curr){
		$.ajax({
			type : "post",
			url : "rechargeableDetail.do",
			dataType : "json",
			data :{
				"id" : id,
				"page" : curr || 1,
				"classes":$("#classes").val(),
        		"title":$("#title").val(),
        		"resourcesId":$("#resourcesId").val(),
        		"repositoryProduct":$("#repositoryProduct").val(),
        		"project":$("#project").val(),
			},
			beforeSend : function(XMLHttpRequest) {
			},
			success : function(res){
				var str = "";
				$("#findUser").html("");

				for ( var i = 0; i < res[0].payOrderDetailList.length; i++) {
					str += "<tr>"
					 		+"<td>" 
							+(i + 1)
							+ "</td><td> <label id=>"
							+ res[0].payOrderDetailList[i].resourcesType
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].resourcesId
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].resourcesTitle
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].resourcesPrice.toFixed(2)
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].resourcesPreferential.toFixed(2)
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].resourcesCount
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].repositoryProductName
							+ "</label></td><td><label >"
							+ res[0].payOrderDetailList[i].projectName
							+ "</label></td>"
							+ "</tr>";
				}
				$("#findUser").append(str);
					laypage({
					cont : document.getElementById('page2'), //容器。值支持id名、原生dom对象，jquery对象,
					pages : res[0].count, //总页数
					skip : true, //是否开启跳页
					skin : 'molv', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
					curr: curr || 1,
					last: res[0].count,
					groups : 6,//连续显示分页数
					jump : function(obj, first) { //触发分页后的回调
						if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
							queryUser(obj.curr);
							 curr = obj.curr;
						}
					}
				});
			}
		});
	
	}
//清空筛选
function deleteSearch(){
	$("#classes").val("");
	$("#title").val("");
	$("#resourcesId").val("");
	$("#repositoryProduct").val("");
	$("#project").val("");
	queryUser(1);
}
</script>
